/**
 * Place holder for copyright, needs to be replaced before release.
 */
package com.softao.ming.gwt.ui.client;

import com.softao.ming.gwt.internal.ui.client.layout.PaneLayoutArea;
import com.softao.ming.gwt.internal.ui.client.layout.StackLayoutArea;

/**
 * Help methods for the {@link IPageLayout}.
 * <p>
 * This may be implemented as the deferred binding.
 */
public class PageLayoutHelper {
	private static PageLayoutHelper mInstance;

	/**
	 * In future, this may using the deferred binding to create different
	 * layout widget for different browser platform.
	 * 
	 * @return the default instance of the {@link PageLayoutHelper}.
	 */
	public static final PageLayoutHelper get() {
		if (mInstance == null) {
			mInstance = new PageLayoutHelper();
		}
		return mInstance;
	}

	/**
	 * @param isVertical
	 *            <code>true</code> if the views are listed vertically;
	 *            otherwise, the views are list horizontally.
	 * @return a widget which can contain list of views, and all views are
	 *         visible all the time.
	 */
	public ILayoutArea createPaneArea(boolean isVertical) {
		return new PaneLayoutArea(isVertical);
	}

	/**
	 * @param isVertical
	 *            <code>true</code> if views are listed vertically. currently,
	 *            it's value always as true.
	 * @return a widget which can contain list of views, and no more than one
	 *         view is visible at any given moment.
	 */
	public ILayoutArea createStackArea(boolean isVertical) {
		return new StackLayoutArea(isVertical);
	}

	private PageLayoutHelper() {
	}
}
